<!--
 * @Author: daidai
 * @Date: 2022-03-01 09:16:22
 * @LastEditors: sunliq sunliq@chanjet.com
 * @LastEditTime: 2023-06-26 23:07:56
 * @FilePath: \web-pc\src\pages\big-screen\components\item-wrap\item-wrap.vue
-->
<template>
  <div class="lr_titles" :style="{height: type == 1 ? height : '',  background: backgroundColor}">
    <div class="item_title" v-if="title !== ''">
      <span :class="titleClass || 'darkness'" class="title-inner"> &nbsp;&nbsp;{{ title }}&nbsp;&nbsp; </span>
      <div class="zhong-bg"></div>
    </div>
    <span v-if="rightText" class="item_title_history" :style="rightTextStyle" @click="searchHistory">{{rightText}}</span>
    <div class="right_icon_box">
      <slot name="RightIcon"></slot>
    </div>
    <div :class="title !== '' ? 'item_title_content' : 'item_title_content_def'">
      <slot></slot>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {};
  },
  props: {
    title: {
      type: String,
      default: () => "",
    },
    titleClass: {
      type: String,
      default: () => ''
    },
    rightText: {
      type: String,
      default: () => "",
    },
    rightTextStyle: {
      type: Object,
      default: () => {}
    },
    type: { // 1 为弹窗
      type: Number,  
      default: 0
    },
    source: {
      type: String,
      default: () => "",
    },
    height: {
      type: String,
      default: () => "300px"
    },
    backgroundColor: {
      type: String,
      default: () => ''
    }
  },
  created() {},

  mounted() {},
  methods: {
    searchHistory() {
      this.$emit('search-history', this.source, this.title)
    }
  },
};
</script>
<style lang='scss' scoped>
$item-title-height: 38px;
$item_title_content-height: calc(100% - 38px);

.lr_titles {
  box-sizing: border-box;
    background-color: rgba(1, 20, 48, 0.5);
    box-sizing: border-box;
    border-width: 1px;
    border-style: solid;
    border-color: rgba(15, 205, 232, 0.7);
    border-radius: 5px;
    -moz-box-shadow: 0px 0px 8px rgba(23, 180, 246, 0.6);
    -webkit-box-shadow: 0px 0px 8px rgb(23 180 246 / 60%);
    box-shadow: 0px 0px 8px rgb(23 180 246 / 60%);
    color: #FFFFFF;
    position: relative;
    .item_title_history {
      position: absolute;
      right: 15px;
      top: 15px;
      color: #31abe3;
      cursor: pointer;
      &:hover{
        color: #31abe3;
        opacity: 0.7;
      }
    }
    .right_icon_box {
      position: absolute;
      right: 15px;
      top: 15px;
      display: flex;
      align-items: center;
    }

  :deep(.border-box-content)  {
    box-sizing: border-box;
    padding: 6px 16px 0px;
  }

  .item_title {
    height: $item-title-height;
    line-height: $item-title-height;
    width: 100%;
    color: #31abe3;
    text-align: center;
    // background: linear-gradient(to right, transparent, #0f0756, transparent);
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    .zhong-bg {
      margin:0 auto;
      top: -2px;
      display: flex;
      opacity: 0.8;
      position: absolute;
      width: 248px;
      height: 64px;
      background-image: url("../../assets/img/wrap-top.png");
    }

    .you {
      transform: rotate(180deg);
    }
    .title-inner {
      font-size: 18px;
      color: #000;
      &.darkness {
        font-weight: 900;
        letter-spacing: 2px;
        background: linear-gradient(
          92deg,
          #0072ff 0%,
          #00eaff 48.8525390625%,
          #01aaff 100%
        );
        -webkit-background-clip: text;
        -webkit-text-fill-color: transparent;
      }
    }
  }

  .item_title_content {
    height: $item_title_content-height;
  }

  .item_title_content_def {
    width: 100%;
    height: 100%;
  }
}

.lr_titles_dialog {
  background-color: rgba(1, 20, 48, 1);
}
</style>